﻿// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include "common.h"
#include "db_info.h"
#include "contact.h"

DWORD BaseAddr = GetWechatWinAaddr();

void boot(HMODULE hModule)
{

    //获取数据库信息
    //GetDbInfo(BaseAddr);

    //获取联系人列表
    HookContactList(BaseAddr);

    //注册窗口
    RegisterWindow(hModule);

}

void shutdown() {

    //取消hook联系人
    UnHookContactList(BaseAddr);

}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{

    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:

        //启动线程来初始化界面
        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)boot, hModule, 0, NULL);

		break;
    case DLL_THREAD_ATTACH:
		break;
    case DLL_THREAD_DETACH:
		break;
    case DLL_PROCESS_DETACH:

        shutdown();

        break;
    }

    return TRUE;
}

